class UserLogo < ActiveRecord::Base
  
  acts_as_fleximage :image_directory => 'public/upload/user_logo'
  use_creation_date_based_directories true
  image_storage_format :jpg
  require_image true
  missing_image_message  '必须指定'
  invalid_image_message '不是一个有效的图片文件'
  output_image_jpg_quality  100
  preprocess_image do |image|
    image.resize '480x320'
  end
  
  belongs_to :user
  
  def after_create
    Feed::MoneyLogo.create!(
      :user_id => user.id          
    ) if UserLogo.find_all_by_user_id(user_id).size == 1
  end
end
